package com.sgb.contract.view.ui.fragment;

import com.sgb.contract.api.AbstractCallBack;
import com.sgb.contract.api.ContractNet;
import com.sgb.contract.base.viewmodel.BaseViewModel;
import com.sgb.contract.model.ContractOperationLogBean;
import com.sgb.contract.view.ui.details.OtherInfoAdapter;
import com.swgk.core.base.model.entity.BaseEntity;

import java.util.List;

public class OperationRecordsViewModel extends BaseViewModel {

    public OtherInfoAdapter adapter;

    public OperationRecordsViewModel() {
        adapter = new OtherInfoAdapter(application.getApplicationContext());
    }

    /**
     * 获取合同操作记录
     * @param contractNo
     */
    public void getContractLog(String contractNo) {
        ContractNet.getInstance().getContractApi().getContractLog(contractNo).enqueue(new AbstractCallBack<BaseEntity<List<ContractOperationLogBean>>>() {
            @Override
            public void onSuccess(BaseEntity<List<ContractOperationLogBean>> data) {
                adapter.setDatas(data.getData());
                adapter.notifyDataSetChanged();
            }
        });
    }
}
